Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add default value for globPatterns #3989

Merged
merged 3 commits into from
Feb 7, 2018
Merged

Conversation

viankakrisna
Copy link
Contributor

without this, the latest alpha broke on start

/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130
    .reduce(
     ^

TypeError: Cannot read property 'reduce' of undefined
    at findPkgs (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130:6)
    at getMonorepoPkgPaths (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:143:22)
    at Object.<anonymous> (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:155:55)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
error Command failed with exit code 1.

without this, the latest alpha broke on start
```
/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130
    .reduce(
     ^

TypeError: Cannot read property 'reduce' of undefined
    at findPkgs (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130:6)
    at getMonorepoPkgPaths (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:143:22)
    at Object.<anonymous> (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:155:55)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
error Command failed with exit code 1.
```
@Timer
Copy link
Contributor

Timer commented Feb 7, 2018

Hmm, maybe this instead:

diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js
index abd2db3b..5d8c7aaa 100644
--- a/packages/react-scripts/config/paths.js
+++ b/packages/react-scripts/config/paths.js
@@ -140,6 +140,9 @@ const getMonorepoPkgPaths = () => {
   if (monoPkgPath) {
     // get monorepo config from yarn workspace
     const pkgPatterns = require(monoPkgPath).workspaces;
+    if (pkgPatterns == null) {
+      return [];
+    }
     const pkgPaths = findPkgs(path.dirname(monoPkgPath), pkgPatterns);
     // only include monorepo pkgs if app itself is included in monorepo
     if (pkgPaths.indexOf(appDirectory) !== -1) {

@Timer Timer added this to the 2.0.0 milestone Feb 7, 2018
@Timer Timer merged commit 47d2d94 into facebook:next Feb 7, 2018
tvalentius added a commit to tvalentius/create-react-app that referenced this pull request Feb 7, 2018
Ensure workspaces key exists in parent package.json (facebook#3989)
1msoft added a commit to 1msoft/create-react-app that referenced this pull request Feb 10, 2018
akstuhl pushed a commit to akstuhl/create-react-app that referenced this pull request Mar 15, 2018
* add default value for globPatterns

without this, the latest alpha broke on start
```
/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130
    .reduce(
     ^

TypeError: Cannot read property 'reduce' of undefined
    at findPkgs (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130:6)
    at getMonorepoPkgPaths (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:143:22)
    at Object.<anonymous> (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:155:55)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
error Command failed with exit code 1.
```

* also check for pkgPatterns for null

* Update paths.js
Timer added a commit to Timer/create-react-app that referenced this pull request Sep 18, 2018
zmitry pushed a commit to zmitry/create-react-app that referenced this pull request Sep 30, 2018
* add default value for globPatterns

without this, the latest alpha broke on start
```
/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130
    .reduce(
     ^

TypeError: Cannot read property 'reduce' of undefined
    at findPkgs (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130:6)
    at getMonorepoPkgPaths (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:143:22)
    at Object.<anonymous> (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:155:55)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
error Command failed with exit code 1.
```

* also check for pkgPatterns for null

* Update paths.js
zmitry pushed a commit to zmitry/create-react-app that referenced this pull request Sep 30, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants